// pages/cat_mse_look/cat_sex.js
const app = getApp()
var that
Page({
  data: {
    cat_id:"",
    sex_class:1,
    cat_GG:"../../images/GG.png",
    cat_MM: "../../images/MM.png",
  },
  onLoad: function (options) {
    that=this
    that.setData({ cat_id: options.id });
    if (options.sex=="MM")
    {
      that.setData({ sex_class: 2 });
    }

  },

  onReady: function () {
  
  },

  onShow: function () {
  
  },

  onHide: function () {
  
  },
  select_sex:function(e){
    console.log(e.currentTarget.dataset.type);
    if (e.currentTarget.dataset.type=="GG")
    {
      that.setData({ sex_class:1});
    }
    if (e.currentTarget.dataset.type == "MM") {
      that.setData({ sex_class: 2 });
    }
  },
  ok:function(){//修改猫咪性别
    app.update_cat_msg("sex", that.data.sex_class, that.data.cat_id);
    wx.navigateBack({  //返回上一级
      delta: 1
    })
  }
})